package daoImpl;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.hibernate.Session;
import org.hibernate.SessionFactory;

import utility.Utility;
import dao.InvoiceDAO;
import domain.Invoice;

public class InvoiceDaoImpl implements InvoiceDAO {
	protected static Logger log = Logger.getLogger(InvoiceDaoImpl.class);
	
	@Resource(name = "sessionFactory")
	SessionFactory sessionFactory;

	@Override
	public void addInvoice(Invoice invoice) {
		log.debug("Adding a new invoice ...");
		Session session = Utility.getSession(sessionFactory);
		session.save(invoice);
		log.debug("Added an invoice successfully.");
	}
}
